package cn.dt.ymcc.doc;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 针对于  Employee 表的文档映射
 * indexName：索引库
 * type：类型(表类型)
 */
@Document(indexName = "course" , type = "_doc")
@Data
public class CourseDoc {

    //对应文档的id  PUT  /index/type/id
    @Id
    private Long id;

     //course中的字段==============================

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    private String name; //课程名

    @Field(type = FieldType.Keyword)    //指定为 不分词
    private String forUser; //使用人群

    @Field(type = FieldType.Date)
    private Date onlineTime;

    @Field(type= FieldType.Keyword)
    private String pic;

    @Field(type= FieldType.Long)
    private Long courseTypeId;

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word") //分词
    private String teacherNames;

    @Field(type = FieldType.Keyword)    //指定为 不分词
    private String gradeName;

    //CourseMarket中的字段===========================
    @Field(type = FieldType.Integer)    //指定为 不分词
    //免费1，收费2
    private Integer charge;

    @Field(type = FieldType.Double)
    private BigDecimal price;
    //CourseSummary字段==============================
    @Field(type = FieldType.Integer)
    private Integer saleCount; //销量

    @Field(type = FieldType.Integer)
    private Integer viewCount;//浏览量
    @Field(type = FieldType.Integer)
    private Integer commentCount;
    //CourseType的字段=================================
    @Field(type= FieldType.Keyword)
    private String typeName;





}